package main

import (
	"fmt"
	"time"
)

const birthTime = "2006-01-02 15:04:05"

func main() {
	ticker := time.NewTicker(time.Second)
	fmt.Println(time.Now().Format(birthTime))
	var stop bool
	go func() {
		time.Sleep(3 * time.Second)
		ticker.Stop()
		stop = true
	}()
	for {
		if stop {
			break
		}
		select {
		case timeTicker := <-ticker.C:
			fmt.Println(timeTicker.Format(birthTime))
		default:
			break
		}
	}
	fmt.Println(time.Now().Format(birthTime))
}
